package com.pjbao.Service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pjbao.Service.dao.PjbUserRepository;
import com.pjbao.Service.model.PersonInfoRecord;

import com.pjbao.Service.model.PjbUser;
import com.pjbao.Service.util.ControllerUtil;
import org.springframework.data.redis.core.RedisTemplate;
import sun.misc.BASE64Encoder;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import java.io.IOException;
import java.util.Map;
import java.util.Timer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/api/v1")
public class ApiController {
    Logger logger = LoggerFactory.getLogger("api service v1");
    @Autowired
    ControllerUtil controllerUtil;
    @Autowired
    LoginTool loginTool;
	@Autowired
	PjbUserRepository pjbUserRepository;
    PjbUser us = new PjbUser();


    //个人信息查询
	@RequestMapping(value="/personInfo/json/", method=RequestMethod.POST )	
	public String exportByJson( PersonInfoRecord info, MultipartFile files) throws Exception {
		logger.info("用户:"+info.getUserid()+" -进入个人查询系统!");
        String result = "";
        result = controllerUtil.personalInvoke(info,files);
		return result;
	}
    
	//企业信息查询
    @RequestMapping(value = "/companyExport/json/",method=RequestMethod.POST)	
	public String companyExport( PersonInfoRecord info) throws Exception {
    	logger.info("进入企业查询系统!==请求的参数是"+info.getComName()+info.getSelectInterface());
        String result = "";
        result = controllerUtil.companyInvoke(info);
		return result;
	}


}
